package com.ywl.controller;

import com.ywl.common.ResponseResult;
import com.ywl.domain.User;
import com.ywl.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @author 24040
 * @name LoginController
 * @date 2022-10-16 9:57
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/user/login")

    public ResponseResult login(@RequestBody User user){
        //登陆
        return loginService.login(user);
    }

    @GetMapping("/user/logout")
    public ResponseResult logout(){
         //退出
        return loginService.logout();
    }


}
